<?php


namespace App\Http\Resources\Mini;

use Illuminate\Http\Resources\Json\ResourceCollection;

class StoreClassCollection extends ResourceCollection
{
    /**
     * Transform the resource collection into an array.
     *
     * @param \Illuminate\Http\Request $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'data' => $this->collection->map(function ($item) {
                return [
                    'id' => $item->id,
                    'cate_name' => $item->cate_name,
                    'status' => $item->status,
//                    'create_time' => date('Y-m-d H:i:s', $item->create_time),
                ];
            }),
            'total' => $this->total(), // 数据总数
            'per_page' => $this->perPage(), // 每页数量
            'current_page' => $this->currentPage(), // 当前页码
        ];
    }
}
